package com.atguigu.consumer.sao;

import com.atguigu.consumer.sao.fallback.UserFallback;
import com.atguigu.consumer.sao.fallback.UserFallbackFactory;
import org.apache.catalina.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 郑启
 * @date 2021/05/13 16:52
 */
@FeignClient(
		name = "provider01",
		path = "/user",
		/*fallback = UserFallback.class,*/
		// fallbackFactory 能提取到异常信息
		fallbackFactory = UserFallbackFactory.class
)
public interface UserSao {
	@GetMapping(value = "/getProfile", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE})
	String getProfile(@RequestParam("profile") String profile);

	@GetMapping(value = "/getTimeout", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE})
	String getTimeout();

	@GetMapping(value = "/getDivide", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE})
	String getDivide(@RequestParam("divisor") int divisor);

	@GetMapping(value = "/getConfigInfo", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE})
	String getConfigInfo();
}
